package com.ruoyi.operationAdministration.service.impl;

import java.util.List;

import com.ruoyi.operationAdministration.vo.EquipmentBookVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.operationAdministration.mapper.OperationEquipmentBookMapper;
import com.ruoyi.operationAdministration.domain.OperationEquipmentBook;
import com.ruoyi.operationAdministration.service.IOperationEquipmentBookService;

/**
 * 设备基础台账Service业务层处理
 *
 * @author lth
 * @date 2023-12-21
 */
@Service
public class OperationEquipmentBookServiceImpl implements IOperationEquipmentBookService
{
    @Autowired
    private OperationEquipmentBookMapper equipmentBookMapper;

    /**
     * 查询设备基础台账
     *
     * @param equipmentId 设备基础台账主键
     * @return 设备基础台账
     */
    @Override
    public OperationEquipmentBook selectEquipmentBookByEquipmentId(String equipmentId)
    {
        return equipmentBookMapper.selectEquipmentBookByEquipmentId(equipmentId);
    }

    /**
     * 查询设备基础台账列表
     *
     * @param equipmentBook 设备基础台账
     * @return 设备基础台账
     */
    @Override
    public List<OperationEquipmentBook> selectEquipmentBookList(OperationEquipmentBook equipmentBook)
    {
        return equipmentBookMapper.selectEquipmentBookList(equipmentBook);
    }

    /**
     * 新增设备基础台账
     *
     * @param equipmentBook 设备基础台账
     * @return 结果
     */
    @Override
    public int insertEquipmentBook(OperationEquipmentBook equipmentBook)
    {
        return equipmentBookMapper.insertEquipmentBook(equipmentBook);
    }

    /**
     * 修改设备基础台账
     *
     * @param equipmentBook 设备基础台账
     * @return 结果
     */
    @Override
    public int updateEquipmentBook(OperationEquipmentBook equipmentBook)
    {
        return equipmentBookMapper.updateEquipmentBook(equipmentBook);
    }

    /**
     * 批量删除设备基础台账
     *
     * @param equipmentIds 需要删除的设备基础台账主键
     * @return 结果
     */
    @Override
    public int deleteEquipmentBookByEquipmentIds(String[] equipmentIds)
    {
        return equipmentBookMapper.deleteEquipmentBookByEquipmentIds(equipmentIds);
    }

    /**
     * 删除设备基础台账信息
     *
     * @param equipmentId 设备基础台账主键
     * @return 结果
     */
    @Override
    public int deleteEquipmentBookByEquipmentId(String equipmentId)
    {
        return equipmentBookMapper.deleteEquipmentBookByEquipmentId(equipmentId);
    }

    /**     设备基础台账列表
    * @Author lth
    * @Description //TODO
    * @Date 16:40 2023/12/21
    * @Param
    * @return
     **/
    @Override
    public List<OperationEquipmentBook> getEquipmentBookList(EquipmentBookVo vo) {
        String keyWord = vo.getKeyWord();
        if (keyWord!=null){
            List<OperationEquipmentBook> equipmentBookList = equipmentBookMapper.getByKeyWord(keyWord);
            return equipmentBookList;
        }else {
            return equipmentBookMapper.selectEquipmentBookList(null);
        }

    }
}
